package com.lvzero.answer;

import com.lvzero.answer.service.AwardService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 答题系统后端的api ;
 */
@SpringBootApplication(scanBasePackages = "com.lvzero.answer")
@MapperScan("com.lvzero.answer.mapper")
public class AnswerApiApplication implements WebMvcConfigurer {

    public static void main(String[] args) {
        SpringApplication.run(AnswerApiApplication.class, args);

    }

    /**
     * 【注意】
     * 默认情况下并不需要添加此配置即可访问
     * http://localhost:8008/doc.html
     * 如果不能访问，加上下面的配置试试，来自官方的建议
     * 使用SpringBoot集成swagger-bootstrap-ui后，都无法访问doc.html界面
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }

}


